const qcloud = require('../vendor/wafer2-client-sdk/index')
const config = require('../config.js')
const service = config.service

function updateSession(code, openId) {
  qcloud.request({
    url: `${service.wxUrl}/updateSession`,
    method: 'Post',
    login: true,
    data: {
      code: code,
      open_id: openId,
    },
    success(result) {
      console.log(result)
    },
    fail(error) {
      util.showModel('请求失败', error)
      console.log('request fail', error)
    }
  })
}

module.exports = {
  updateSession
}